package com.atguigu.tingshu.user.strategy;

import com.atguigu.tingshu.common.execption.GuiguException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
@Component
public class StragetyFactoryBean {
    @Autowired
    private Map<String,OrderSrategy> map;
    public OrderSrategy getStrategy(String itemType){
        if (map.containsKey(itemType)){
            return map.get(itemType);
        }
        throw new GuiguException(500,"不存在该策略模式");
    }
}
